package core.hiberante4.common;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Component;

@Component("CommonHibernateDao")
public class CommonDao implements ICommonDao{

	private SessionFactory sessionFactory;
	
	public Session getSession(){
		return sessionFactory.getCurrentSession();
	}
	
	@Override
	public <E extends CommonEntity> void save(E entity) {
		getSession().save(entity);
	}

	@Override
	public <E extends CommonEntity> void delete(E entity) {
		getSession().delete(entity);
	}

	@Override
	public <E extends CommonEntity> void update(E entity) {
		getSession().update(entity);
	}
	
	

}
